package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.dto.UserLoginDto;
import com.zzyl.nursing.dto.projectPageDto;
import com.zzyl.nursing.service.IFamilyMemberService;
import com.zzyl.nursing.vo.LoginVo;
import com.zzyl.serve.domain.NursingProject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 老人家属Controller
 * 
 * @author ruoyi
 * @date 2025-10-22
 */
@RestController
@RequestMapping("/member")
@Api(tags = "老人家属相关接口")
public class FamilyMemberController extends BaseController
{
    @Autowired
    private IFamilyMemberService familyMemberService;






    /**
     * 登录
     */

    @ApiOperation("小程序登录")
    @PostMapping("/user/login")
    public AjaxResult login(@RequestBody UserLoginDto dto) {

        LoginVo loginVo = familyMemberService.login(dto);

        return success(loginVo);
    }

    @GetMapping("/orders/project/page")
    public TableDataInfo getInfo(projectPageDto dto){
        startPage();
        List<NursingProject> list = familyMemberService.getInfo(dto);
        return getDataTable(list);
    }

    @GetMapping("/orders/project/{id}")
    public AjaxResult getProjectById(@PathVariable Integer id){

        NursingProject nursingProject  =familyMemberService.getProjectById(id);
        return success(nursingProject);
    }

}
